package com.baizhi.service.Impl;

import com.baizhi.dao.UserDao;
import com.baizhi.User;
import com.baizhi.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserserviceImpl implements UserService {
    @Autowired
    private UserDao us;
    @Override
    public boolean login(String name, String pwd) {
        QueryWrapper<User> qw=new QueryWrapper<User>();
        qw.eq("username",name);
        qw.eq("password",pwd);
        User user = us.selectOne(qw);
        if (user==null){
            return false;
        }else{
            if (user.getUsername().equals(name)&&user.getPassword().equals(pwd)){
                return true;
            }
        }
        return false;
    }
}
